#include<stdio.h>
#include<math.h>
/*
输入16进制字符串型转10进制输出
*/
int main(void)
{
    //声明初始化变量
	char a[20] = {"B629"}; //存放字符串B629,应该输出46633
	int b[20] = { 0 }; //存放字符串转化成的int型
	int i = 0, j = 0;
	int sum = 0;
	int c = 0;//存放十进制

	//char型转int型，存到b[]中
	while (a[sum] != '\0'){ 
	if ((a[sum] >= 'a') && (a[sum] <= 'z'))
		{
			b[sum] = a[sum] - 'a' + 10;
			sum++;
			continue;
		}
		if ((a[sum] >= 'A') && (a[sum] <= 'Z'))
		{
			b[sum] = a[sum] - 'A' + 10;
			sum++;
			continue;
		}
		b[sum] = a[sum] - '0';
		sum++;
	}
 
	//转化成16进制
	for (i = 0; i < sum; i++)
	{
		b[sum - i - 1] = b[sum - i - 1] * pow(16, i);
	}
 
	//累加得出结果
	for (j = 0; j < sum; j++)
	{
		c = c + b[j];
	}
	printf("%d", c);
    
	return 0;
}